package com.zzyl;

import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.core.auth.Auth;
import com.baidubce.qianfan.model.chat.ChatResponse;

public class Demo {
    public static void main(String[] args) {
        // 使用安全认证AK/SK鉴权，替换下列示例中参数，安全认证Access Key替换your_iam_ak，Secret Key替换your_iam_sk，如何获取请查看https://cloud.baidu.com/doc/Reference/s/9jwvz2egb
        Qianfan qianfan = new Qianfan(Auth.TYPE_OAUTH,"24ZKOMJwNwDuQ6WevNMIRokJ", "eo5BFCjBcekdrElqhdLvyor0KuKalBeC");

        String prompt  =  "帮我生成有个体检报告结果的模板数据";

        // 指定模型
       ChatResponse resp = qianfan.chatCompletion()
                .model("ERNIE-4.0-8K-Preview")
                .addMessage("user", prompt)
                .temperature(0.7)
                .maxOutputTokens(2048)
                .responseFormat("json_object")
                .execute();
        System.out.println(resp.getResult());
    }
}